package org.rockyang.shardingjdbc.mybatisplus.common.task;

import org.rockyang.shardingjdbc.mybatisplus.common.config.SnowflakeInitiator;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;


@Component
public class SnowflakeTask {

    @Autowired
    private SnowflakeInitiator snowflakeInitiator;

    // key的过期时间是24小时  每小时刷新一次
    @Scheduled(fixedDelay = 1000 * 60 * 60)
    private void snowflakeInitiator_ResetExpire() {
        snowflakeInitiator.resetExpire();
    }


}
